SHELL=/bin/bash
CPP=g++
AR=ar
CPPFLAGS=-Wall -fPIC -std=c++0x
DEBUG=1 #TODO: remove this line when debugging is no more required
LIBNAME=icecode_http
LIBS=
OBJS=HTTPServer.o
PREFIX=/usr/local

ifdef DEBUG
	CPPFLAGS+=-ggdb -D_DEBUG
endif

.PHONY: clean install help init pkg-config todo

all: lib$(LIBNAME).a

lib$(LIBNAME).a: $(OBJS)
	$(AR) -rus lib$(LIBNAME).a $(OBJS)

$(OBJS): %.o: %.cpp
	$(CPP) -c -o $@ $(CPPFLAGS) $<

clean:
	$(RM) $(OBJS) lib$(LIBNAME).a lib$(LIBNAME).pc

install:
	echo Not yet implemented
	exit 1

pkg-config:
	echo Not yet implemented
	exit 1

init:
	./update-objects.sh

help:
	if [ -z $$PAGER ]; then less README || more README || echo No pager available, please view the README file to get help; else $$PAGER README; fi

todo:
	if [ -z $$PAGER ]; then less TODO || more TODO || echo No pager available, please view the TODO file to view the list; else $$PAGER TODO; fi

